
package cn.bluethink.zentao.model;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * @title 根对象
 * @Copyright 苏州中科蓝迪公司所有(c)2016-2021
 * @version 0.1
 *
 * @note 修订历史： （1）liuxn于2018年8月14日构建初始版本0.1
 */
public class ZtObject {

	/**
	 * 对象的唯一标识
	 */
	private Long id = new Long(0);
	
	/**
	 * 对象名
	 */
	@JsonInclude(JsonInclude.Include.NON_NULL)
	private String name;
	 
	/**
	 * @since 1.0.0
	 * @roseuid 5B67AC4F0190
	 */
	public ZtObject() {
	}
	
	public ZtObject(Long id, String name) {
        this.id = id;
        this.name = name;
    }
	
	@Override
	public boolean equals(Object obj) {
		return !(obj instanceof ZtObject) || this.id == null ? false : this.id.equals(((ZtObject)obj).id);
	}
	
	public void depthCopy(ZtObject obj) {
	    this.id = obj.id;
	    this.name = obj.name;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 判断对象ID是否有效
	 * @return
	 */
	public boolean isValidate() {
		return this.id > 0 ? true : false;
	}
}
